package geometry2D;

import context.*;

import java.awt.geom.Rectangle2D;

import org.json.JSONArray;
import org.json.JSONException;

// ********************************************************************
// *** CLASS: Rektangel2D
// ********************************************************************
public class Projection2D extends Rectangle2D.Double implements Context.Constants
//public class Projection2D implements Context.Constants
{ //private static final boolean DEBUG=true; // Overriding Context.Constants.DEBUG
  static final String TAG="geometry2D.Rektangel2D";
  static final long serialVersionUID=0; // AD'HOC
  
  public Projection2D(double x,double y,double width,double height)
  { super(x,y,width,height); }
  
  public Projection2D(JSONArray json)  throws JSONException
  { this(json.getDouble(0),json.getDouble(1),json.getDouble(2),json.getDouble(3)); }
  
  public JSONArray encode() throws JSONException
  {	JSONArray obj=new JSONArray();
	obj.put(getX());
	obj.put(getY());
	obj.put(getWidth());
	obj.put(getHeight());
	return(obj);
  }
  
  public Projection2D copy()
  { return(new Projection2D(x,y,width,height)); }

  // ******************************************************************
  // *** METHOD: toString
  // ******************************************************************
  public String toString()
  { return("Projection2D[x="+getX()+",y="+getY()+",width="+getWidth()+",height="+getHeight()+"]"); }
}
